package com.vnp.cooking.adapter;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

import com.vnp.cooking.R;
import com.vnp.cooking.bean.ObjSlidingMenu;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class SlidingMenuAdapter extends ArrayAdapter<ObjSlidingMenu>{
	
	Context context;
	ArrayList<ObjSlidingMenu> objSlidingMenus;
	int resource;
	TextView txtObjMenu;
	ImageView imgObjMenu;
	
	public SlidingMenuAdapter(Context context, ArrayList<ObjSlidingMenu> objSlidingMenus) {
		super(context,R.layout.listmenu_item, objSlidingMenus);
		this.context = context;
		this.objSlidingMenus = objSlidingMenus; 
	}


	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			 LayoutInflater inflater = LayoutInflater.from(getContext());
			 convertView = inflater.inflate(R.layout.listmenu_item, parent, false);
			 
			 txtObjMenu = (TextView) convertView.findViewById(R.id.txt_topic);
			 imgObjMenu = (ImageView) convertView.findViewById(R.id.img_topic);
			 
		}
		
		txtObjMenu.setText(objSlidingMenus.get(position).getTxtTopic());
		imgObjMenu.setImageResource(objSlidingMenus.get(position).getImgTopic());
		
		
		return convertView;
	}

	
	
	
	
	
	

}
